package com.leonzx.base.controller.excel;

import com.leonzx.base.controller.base.BaseController;
import com.leonzx.base.entity.system.ExcelTemplate;
import com.leonzx.base.service.system.ExcelTemplateService;
import com.leonzx.base.service.system.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author:李晓雷
 * @Description:
 * @Date: 18/06/29 11:41
 */
@Controller
@RequestMapping("/excelTemplate")
public class ExcelTemplateController extends BaseController {
    @Autowired
    private ExcelTemplateService excelTemplateService;
    @Autowired
    private OrdersService ordersService;
    /**
     * 静态模版所在路径前缀
     */
    private String prefix = "excel";
    /**
     * 跳转到用户管理列表
     *
     * @return
     */
    @RequestMapping("/list")
    public String list() {
        return prefix + "/list";
    }

    /**
     * 跳转到用户添加页面
     *
     * @return
     */
    @RequestMapping("/add")
    public String add(ExcelTemplate excelTemplate, Model model) {
        model.addAttribute("excelTemplate",excelTemplate);
        return prefix + "/edit";
    }

    /**
     * 编辑跳转到详情页面
     * @return
     */
    @RequestMapping("/edit")
    public String edit(ExcelTemplate excelTemplate,Model model){
        ExcelTemplate excelTemplate1 = excelTemplateService.getUserById(excelTemplate);
        model.addAttribute("excelTemplate",excelTemplate1);
        return prefix + "/edit";
    }
    @RequestMapping("/getOrders")
    public String getOrders (Model model){
        return prefix + "/orders-choose";
    }



}
